﻿using UnityEngine;
using System.Collections;


public class AttributeSelector
{
    public string Name { get; private set; }

    public string Value { get; private set; }

    public AttributeSelector(string name, string value)
    {
        Name = name;
        Value = value;
    }

    public bool IsMatch(ReadOnlyHtmlNode node)
    {
        var att = node.GetAttribute(Name);
        if (att == null) return false;
        if (Compare(att.Value, Value))
        {
            return true;
        }
        return false;
    }

    protected virtual bool Compare(string name, string value)
    {
        return name == value;
    }
}

public class IdSelector:AttributeSelector
{
    public IdSelector(string id_name) : base("id", id_name) { }
}

public class ClassSelector : AttributeSelector
{
    public ClassSelector(string class_name) : base("class", class_name) { }
}